#include <glib.h>

typedef struct my_data {
    gint id;
    gchar *name;
}my_data_t;

gint main(gint argc, gchar **argv)
{
    gint *ids = NULL;
    gchar *str = NULL;
    my_data_t *d = NULL;

    gint i = 0;

    ids = g_new(gint, 4);
    g_return_val_if_fail(ids, -1);
    for(i=0;i<4;i++) {
        ids[i] = i+100;
    }

    str = g_new0(gchar, 8);
    g_return_val_if_fail(str, -1);
    g_strlcpy(str, "abcdef", 8);

    d = g_new0(my_data_t, 1);
    g_return_val_if_fail(d, -1);
    d->id = 100;
    d->name = g_strdup("abcd");

    g_print("ids: [%d] [%d] [%d] [%d] \n", ids[0], ids[1], ids[2], ids[3]);
    g_print("str: %s \n", str);
    g_print("d->id:%d, d->name:%s \n", d->id, d->name);
    

    g_free(ids);
    g_free(str);
    g_free(d->name);
    g_free(d);

    return 0;
}